/*     */ package btsm.servlet;
/*     */ 
/*     */ import btsm.bean.sqlBTSWork;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import java.io.PrintWriter;
/*     */ import java.sql.ResultSet;
/*     */ import javax.servlet.RequestDispatcher;
/*     */ import javax.servlet.ServletException;
/*     */ import javax.servlet.http.HttpServlet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import javax.servlet.http.HttpSession;
/*     */ 
/*     */ public class ser_graph extends HttpServlet
/*     */ {
/*     */   public void init()
/*     */     throws ServletException
/*     */   {
/*     */   }
/*     */ 
/*     */   public void doGet(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/*  26 */     String[] addfieldxg = new String[3];
/*     */ 
/*  28 */     String seraction = request.getParameter("seraction");
/*  29 */     String strbtscode = request.getParameter("btscode");
/*  30 */     String strbtsname = request.getParameter("btsname");
/*  31 */     String strsnid = request.getParameter("snid");
/*  32 */     String strToPage = request.getParameter("ToPage");
/*  33 */     addfieldxg[0] = request.getParameter("graphDeatilAddr");
/*  34 */     addfieldxg[1] = request.getParameter("graphHigh");
/*     */ 
/*  36 */     if (strToPage == null) {
/*  37 */       strToPage = request.getParameter("tToPage");
/*     */     }
/*     */ 
/*  40 */     System.out.println("graphDeatilAddr:" + addfieldxg[0]);
/*  41 */     System.out.println("graphHigh:" + addfieldxg[1]);
/*     */ 
/*  44 */     if ((strbtsname != null) && (!strbtsname.equals(""))) {
/*  45 */       strbtsname = new String(strbtsname.getBytes("ISO8859-1"), "UTF-8");
/*     */     }
/*  47 */     request.setAttribute("btscode", strbtscode);
/*  48 */     request.setAttribute("btsname", strbtsname);
/*     */ 
/*  50 */     String filesnames = request.getParameter("filesnames");
/*     */ 
/*  52 */     String msg = "";
/*  53 */     String strRedURL = "common.jsp";
/*     */ 
/*  57 */     if (!seraction.equals("serbtscnbq"))
/*     */     {
/*  59 */       sqlBTSWork PC = new sqlBTSWork("geographicalenv", "1");
/*     */ 
/*  61 */       if (seraction.equalsIgnoreCase("seradd")) {
/*  62 */         String[] fieldsg = request.getParameterValues("T1");
/*     */ 
/*  64 */         int paraSize = fieldsg.length;
/*  65 */         String[] para = new String[paraSize + 1];
/*  66 */         for (int i = 0; i < paraSize; i++)
/*     */         {
/*  68 */           if (i < 7)
/*     */           {
/*  70 */             para[i] = fieldsg[i];
/*  71 */           } else if (i == 7)
/*     */           {
/*  73 */             para[7] = request.getSession().getAttribute("stxtUName").toString();
/*     */           }
/*     */           else {
/*  76 */             para[i] = fieldsg[(i - 1)];
/*     */           }
/*     */         }
/*     */ 
/*  80 */         if (PC.InsertRD(para))
/*  81 */           msg = "新建地理环境成功";
/*     */         else
/*  83 */           msg = "新建地理环境失败";
/*     */       }
/*  85 */       else if (seraction.equalsIgnoreCase("sermodp")) {
/*  86 */         request.setAttribute("snid", strsnid);
/*  87 */         if (strToPage == null) {
/*  88 */           strToPage = "1";
/*     */         }
/*     */ 
/*  91 */         strRedURL = filesnames + "?btscode=" + strbtscode + "&btsname=" + strbtsname + "ToPage=" + strToPage;
/*  92 */       } else if (seraction.equals("serdel")) {
/*  93 */         if (PC.delbyBTSCode(strbtscode))
/*  94 */           msg = "地理环境信息删除成功";
/*     */         else {
/*  96 */           msg = "地理环境删除失败";
/*     */         }
/*  98 */         strsnid = "";
/*     */       }
/* 100 */       else if (seraction.equals("sermod")) {
/* 101 */         String[] fieldxg = request.getParameterValues("T1");
/*     */ 
/* 103 */         if (PC.mdByBTSCode(fieldxg, strbtscode)) {
/* 104 */           PC.mdAddByBTSCode(addfieldxg, strbtscode, "graph");
/* 105 */           msg = "地理环境信息修改成功";
/*     */         } else {
/* 107 */           msg = "地理环境修改失败";
/*     */         }
/*     */       }
/*     */ 
/* 111 */       PC.dbConClose();
/* 112 */       String filesnamesmd = "ser_graph?seraction=sermodp&btscode=" + strbtscode + "&btsname=" + strbtsname + "&filesnames=" + filesnames + "&snid=" + strsnid + "&ToPage=" + strToPage;
/* 113 */       request.setAttribute("filesnames", filesnamesmd);
/* 114 */       request.setAttribute("msg", msg);
/* 115 */       RequestDispatcher btsm = request.getRequestDispatcher(strRedURL);
/* 116 */       btsm.forward(request, response);
/*     */     }
/*     */     else {
/*     */       try {
/* 120 */         String strBTSFilter = request.getParameter("txtBTSFilter");
/* 121 */         sqlBTSWork oBGQuery = new sqlBTSWork("", "0");
/*     */ 
/* 124 */         ResultSet result = oBGQuery.btsCNBQuery(strBTSFilter);
/*     */ 
/* 127 */         StringBuffer results = new StringBuffer("<properties>");
/*     */ 
/* 130 */         while (result.next()) {
/* 131 */           String strbtsCode = result.getString("btscode");
/* 132 */           String strbtsName = result.getString("btsname");
/* 133 */           String strbtsLat = result.getString("lat");
/* 134 */           String strbtsLng = result.getString("lng");
/*     */ 
/* 137 */           results.append("<property>");
/* 138 */           results.append("<btsCode>");
/* 139 */           results.append(strbtsCode);
/* 140 */           results.append("</btsCode>");
/* 141 */           results.append("<btsName>");
/* 142 */           results.append(strbtsName);
/* 143 */           results.append("</btsName>");
/* 144 */           results.append("<btsLat>");
/* 145 */           results.append(strbtsLat);
/* 146 */           results.append("</btsLat>");
/* 147 */           results.append("<btsLng>");
/* 148 */           results.append(strbtsLng);
/* 149 */           results.append("</btsLng>");
/* 150 */           results.append("</property>");
/*     */         }
/*     */ 
/* 154 */         results.append("</properties>");
/* 155 */         response.setContentType("text/xml;charset=UTF-8");
/*     */ 
/* 157 */         response.getWriter().write(results.toString());
/* 158 */         result.close();
/* 159 */         oBGQuery.dbConClose();
/*     */       }
/*     */       catch (ClassNotFoundException e) {
/* 162 */         System.err.print("ClassNotFoundException: ");
/*     */ 
/* 164 */         System.err.println(e.getMessage());
/*     */       }
/*     */       catch (Exception localException)
/*     */       {
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void doPost(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/* 176 */     doGet(request, response);
/*     */   }
/*     */ 
/*     */   public void destroy()
/*     */   {
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.servlet.ser_graph
 * JD-Core Version:    0.6.2
 */